import { createServer } from "vite";

let server;
let watcher;

async function startServer() {
  const isRestart = server ? true : false;

  console.log(`${isRestart ? "res" : "s"}tarting server`);

  server && (await server.close());
  watcher && (await watcher.close());

  server = await createServer({
    plugins: [],
  });

  await server.listen();

  server.printUrls();
}

startServer();
